package com.hm.scala

object For {

  def main(args: Array[String]): Unit = {

    for (i <- 0 to 10) {
      println(i);
    }

    println("-------------华丽分隔符")

    var str = "dcfgvhbjnkmk,./"

    //控制下标
    for (i <- 0 until str.length()) {
      println(i + "======" + str(i));
    }

    println("-------------华丽分隔符")
    for (i <- 0 until str.length) {
      if (i <= 3) {
        println(i + "===33===" + str(i));
      } else {
        println("不满足条件数据");
      }
    }

    println("-------------华丽分隔符")

    for (i <- 0 until str.length if i <= 3) {
      println(i + "===r3===" + str(i));
    }

    //foreach

    println("-------------华丽分隔符")
    (1 to 10) foreach (a => println(a));

    println("-------------华丽分隔符")
    (10 to 15).foreach(number => {

      var a = 10;
      println(a * number)
    });
    
    

  }
}